home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / Asm / Rasterlists / ColourBars.s < prev    next >
Encoding:
Text File  |  1997-05-01  |  4.0 KB  |  137 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Colour List Example
  3. ;-------------------
  4. ;Colourlists are those nice colour gradients used in demos and games,
  5. ;usually  sitting in the background of your screen.  Colourlists are mostly
  6. ;good for getting more colours on screen than what there really is.
  7. ;Although  GMS allows you to do other screen effects based on raster lines,
  8. ;we'll just stick to changing colours in this demo.
  9. ;
  10. ;You can move the green colour bar by moving the joystick up and down.
  11. ;You will notice that if you move the green bar into the upper red bar,
  12. ;your bar will disappear.  This is because:
  13. ;
  14. ;    WAITLINE  95        ;Wait for line 95
  15. ;    WAITLINE 100        ;Wait for line 100
  16. ;    WAITLINE  90        ;Wait for line 90 <--Error! 
  17. ;
  18. ;Is not allowed.  The monitor beam travels down the screen, and so the
  19. ;UpdateRasterlist() routine will expect all lines to be in sequential order.
  20. ;Moving two colourbars into each other breaks this rule, causing the wait
  21. ;command to be ignored.  If you want to get around this, you will have to
  22. ;have just one large colourlist and sort your colours before each call to
  23. ;UpdateRasterlist().
  24. ;
  25. ;Similarly if you move the colour bar too far down the screen the hardware
  26. ;won't like it because lines > 311 don't exist.  It's up to you to be
  27. ;responsible enough to stop this from happening!
  28. ;
  29. ;Press FIRE to exit the demo.
  30.  
  31.     INCDIR    "INCLUDES:"
  32.     INCLUDE    "games/games_lib.i"
  33.     INCLUDE    "games/games.i"
  34.  
  35. CALL    MACRO
  36.     jsr    _LVO\1(a6)
  37.     ENDM
  38.  
  39. ;===========================================================================;
  40. ;                             INITIALISE DEMO
  41. ;===========================================================================;
  42.  
  43.     SECTION    "Colourlist",CODE
  44.  
  45.     STARTGMS
  46.  
  47. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  48.     move.l    GMSBase(pc),a6
  49.     lea    ScreenTags(pc),a0
  50.     CALL    ShowScreen
  51.     tst.l    d0
  52.     beq.s    .Error_Screen
  53.  
  54.     CALL    InitJoyPorts
  55.  
  56.     bsr.s    Loop
  57.  
  58. .ReturnToDOS
  59.     move.l    GMSBase(pc),a6
  60.     move.l    Screen(pc),a0
  61.     CALL    DeleteScreen
  62. .Error_Screen
  63.     MOVEM.L    (SP)+,A0-A6/D1-D7
  64.     moveq    #ERR_OK,d0
  65.     rts
  66.  
  67. ;===========================================================================;
  68. ;                                MAIN LOOP
  69. ;===========================================================================;
  70.  
  71. Loop:    move.l    Screen(pc),a0
  72.     moveq    #JPORT1,d0
  73.     CALL    ReadMouse
  74.     btst    #MB_LMB,d0
  75.     bne.s    .done
  76.     ext.w    d0
  77.     lea    Bar2(pc),a1
  78.     add.w    d0,2(a1)
  79. .chkhi    cmp.w    #226,2(a1)
  80.     blt.s    .chklo
  81.     move.w    #226,2(a1)
  82. .chklo    tst.w    2(a1)
  83.     bgt.s    .update
  84.     clr.w    2(a1)
  85. .update    CALL    UpdateRasterLines    ;Update our rasterlist.
  86.     CALL    WaitVBL
  87.     bra.s    Loop
  88. .done    rts
  89.  
  90. ;===========================================================================;
  91. ;                                  DATA
  92. ;===========================================================================;
  93.  
  94. ScreenTags:
  95.     dc.l    TAGS_GAMESCREEN
  96. Screen:    dc.l    0
  97.     dc.l    GSA_Rasterlist,Rasterlist
  98.     dc.l    GSA_Planes,1
  99.     dc.l    GSA_Attrib,BLKBDR
  100.     dc.l    TAGEND
  101.  
  102. ;===========================================================================;
  103.  
  104. RasterList:
  105. Bar1:    COLOURLIST 000,3,00,ColourBar1    ;Line, Skip, Colnum, ColourList.
  106. Bar2:    COLOURLIST 160,1,00,ColourBar2    ;Line, Skip, Colnum, ColourList.
  107.     COLOURLIST 230,1,00,ColourBar3    ;Line, Skip, Colnum, ColourList.
  108.     RASTEND
  109.  
  110. ColourBar1:
  111.     dc.l    $100000,$200000,$300000,$400000,$500000
  112.     dc.l    $600000,$700000,$800000,$900000,$a00000
  113.     dc.l    $b00000,$c00000,$d00000,$e00000,$e00000
  114.     dc.l    $e00000,$d00000,$c00000,$b00000,$a00000
  115.     dc.l    $900000,$800000,$700000,$600000,$500000
  116.     dc.l    $400000,$300000,$200000,$100000,$000000
  117.     dc.l    -1
  118.  
  119. ColourBar2:
  120.     dc.l    $001000,$002000,$003000,$004000,$005000
  121.     dc.l    $006000,$007000,$008000,$009000,$00a000
  122.     dc.l    $00b000,$00c000,$00d000,$00e000,$00f000
  123.     dc.l    $00e000,$00d000,$00c000,$00b000,$00a000
  124.     dc.l    $009000,$008000,$007000,$006000,$005000
  125.     dc.l    $004000,$003000,$002000,$001000,$000000
  126.     dc.l    -1
  127.  
  128. ColourBar3:
  129.     dc.l    $000010,$000020,$000030,$000040,$000050
  130.     dc.l    $000060,$000070,$000080,$000090,$0000a0
  131.     dc.l    $0000b0,$0000c0,$0000d0,$0000e0,$0000f0
  132.     dc.l    $0000e0,$0000d0,$0000c0,$0000b0,$0000a0
  133.     dc.l    $000090,$000080,$000070,$000060,$000050
  134.     dc.l    $000040,$000030,$000020,$000010,$000000
  135.     dc.l    -1
  136.  
  137.